#ifndef _POINTER_H_
#define _POINTER_H_

#include "Object.h"

namespace MySTL
{

template < typename T >
class Pointer : public Object
{
public:
	Pointer(T* ptr = NULL);

	virtual T* ptr() const;
	virtual T& operator *() const;
	virtual T* operator ->() const;
	virtual bool isNull() const;
	virtual void reset(T* ptr = NULL) = 0;

protected:
	Pointer(const Pointer& obj);
	Pointer& operator =(const Pointer& obj);

protected:
	T* m_ptr;
};

template < typename T >
Pointer<T>::Pointer(T* ptr)
{
	m_ptr = ptr;
}

template < typename T >
T* Pointer<T>::ptr() const
{
	return m_ptr;
}

template < typename T >
T& Pointer<T>::operator *() const
{
	return *m_ptr;
}

template < typename T >
T* Pointer<T>::operator ->() const
{
	return m_ptr;
}

template < typename T >
bool Pointer<T>::isNull() const
{
	return (m_ptr == NULL);
}
	
}

#endif